package com.yhsimon.realm.member.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class MyMQConfig {


    @Bean
    public Exchange orderEventExchange() {
        // String name, boolean durable, boolean autoDelete, Map<String, Object> arguments
        return new TopicExchange("bean-event-exchange", true, false);
    }


    @Bean
    public Queue orderSeckillOrderQueue() {
        // String name, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments
        return new Queue("bean.seckill.queue", true, false, false);
    }


    @Bean
    public Binding orderSeckillOrderQueueBinding() {
        return new Binding("bean.seckill.queue",
                Binding.DestinationType.QUEUE,
                "bean-event-exchange",
                "bean.seckill",
                null);
    }

}
